<?php
namespace app\admin\model;

use think\Model;

class  Category extends Model
{
    public static function getCateList($id)
    {
        $list=Category::name("category")->where('parentid',$id)->order('sort')->select()->toArray();
        foreach ($list as $k=>$v){
            $list2=Category::name('category')->where('parentid',"{$v['id']}")->select()->toArray()  ;
            $list[$k]['list']=$list2;
        }
        return $list;
    }

    public static function getPar()
    {
        return Category::name('category')->where('parentid','0')->order('sort')->select();
    }
}